A flash memory is known as a semiconductor device. One type of the flash memory employs a gate electrode that is formed of a polycide, which is a layered structure including a silicide film and a polysilicon film, or a polymetal, which is a layered structure including a metal film and a polysilicon film. With these gate electrodes, a protective film may be provided, for example, in order to prevent oxidation of the gate electrode, or to prevent diffusion of a dopant from the gate electrode. During processing of films including the gate electrode and the protective film, a width of the protective film may become narrower as the side of the protective film is etched. In accordance with the narrowed protective film, a width of the patterned structure may become narrower, and this may cause a collapse of the pattern structure during the patterning process.